#pragma once

//Class Definition//
class CButton
{
private:
	//Class Variables----------------------------------------------//
	wchar_t		m_Text[32];		//String to display on top of button//
	D3DXVECTOR2 m_Position;		//Used to Translate the button//
	RECT		m_ScreenBox;	//Used in draw text function//
	enum						//Used in KeyBOARD selection of button//
	{
		selected, idle			//Two states currently; 0 and 1//
	} state;

	//Class Functions----------------------------------------------//
public:
	//Set the Text that will be displayed over the button//
	void setText (wchar_t newText[])
	{
		//wsprintf returns the length of the text put into it, minus the null character//
		if(wsprintf(m_Text, L"%s", newText) == (sizeof(newText)-1))
			::MessageBoxA(NULL, "Error in Setting Text for Button", "Button Failure", MB_OK | MB_ICONERROR);
	}
	//Set the position that the button will be at in 3D space//
	void setPosition(float newX, float newY)
	{
		m_Position.x = newX;
		m_Position.y = newY; 
	}
	//Another option for setting the buttons location//
	void setPosition(D3DXVECTOR2 newPosition)
	{
		m_Position = newPosition;
	}
	//Set the X independently//
	void SetX(float newX)
	{
		m_Position.x = newX;
	}
	//Set the Y Independently//
	void SetY(float newY)
	{
		m_Position.y = newY;
	}
	//Sets the RECT that will be used for text placement//
	void SetRECT(void)
	{
		//TODO
	}
	void SetRECTX(float newLeft, float newRight)
	{
		m_ScreenBox.left = long(newLeft);
		m_ScreenBox.right = long(newRight);
	}
	void SetRECTY(float newTop, float newBottom)
	{
		m_ScreenBox.top = long(newTop);
		m_ScreenBox.bottom = long(newBottom);
	}
	//Sets the State of the button//
	void SetState(int newState)
	{
		if(newState == 1)
		{
			state = selected;
		}
		else
		{
			state = idle;
		}
	}
	//Call to set the state to idle without passing in an int//
	void SetStateIdle(void)
	{
		state = idle;
	}
	//Call to set the state to selected without passing in an int//
	void SetStateSelected(void)
	{
		state = selected;
	}

	//Get Functions------------------------------------------------//
	//Returns the Text displayed over the button//
	wchar_t* getText(void)
	{
		return m_Text;
	}
	//Returns the position of the button//
	D3DXVECTOR2 getPosition(void)
	{
		return m_Position;
	}
	//Returns the X coordinate//
	float getX(void)
	{
		return m_Position.x;
	}
	//Returns the Y coordinate//
	float getY(void)
	{
		return m_Position.y;
	}
	//Returns the RECT that correlates with this button//
	RECT* getRECT(void)
	{
		return &m_ScreenBox;
	}
	//Returns the state of the button//
	int getState(void)
	{
		return state;
	}
	void CleanUp(void)
	{
		ZeroMemory(m_Text, sizeof(m_Text));
	}
};